#include <linux/types.h>
#include <linux/list.h>
#include <linux/miscdevice.h>
+#include <linux/poll.h>
#include <asm/uaccess.h>
#include <asm-xen/xenbus.h>
#include <asm-xen/xen-public/grant_table.h>
}
static unsigned int
-vtpm_op_poll(struct file *file, struct poll_table_struct *pst)
+vtpm_op_poll(struct file *file, struct poll_table_struct *pts)
{
- return 0;
+ unsigned int flags = POLLOUT | POLLWRNORM;
+ poll_wait(file, &dataex.wait_queue, pts);
+ if (!list_empty(&dataex.pending_pak)) {
+ flags |= POLLIN | POLLRDNORM;
+ }
+ return flags;
}
static struct file_operations vtpm_ops = {
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/tpmfe.h>
+#include <linux/err.h>
#include <asm/semaphore.h>
#include <asm/io.h>
info->watch.callback = watch_for_status;
err = register_xenbus_watch(&info->watch);
if (err) {
- message = "registering watch on backend";
+ xenbus_dev_error(dev, err, "registering watch on backend");
goto destroy_tpmring;
}
int err;
struct tpmfront_info *info;
int handle;
+ int len = max(XS_WATCH_PATH, XS_WATCH_TOKEN) + 1;
+ const char *vec[len];
err = xenbus_scanf(NULL, dev->nodename,
"handle", "%i", &handle);
return err;
}
+ vec[XS_WATCH_PATH] = info->watch.node;
+ vec[XS_WATCH_TOKEN] = NULL;
+ watch_for_status(&info->watch, vec, len);
+
return 0;
}